#include "UTextButton.h"
#include "UControl.h"

using namespace std;

TTextButton::TTextButton(string text, TGLFontRef font, TRectangle rect)
: TButton(rect)
, Font(font)
{
	Text = text;
}

void TTextButton::Draw( )
{
	if (Pressed) glTranslatef(1, 1, 0);

	glColor3f(0.9, 0.7, 0.7);
	glBegin(GL_QUADS);
		glVertex2i(Left		, Top);
		glVertex2i(Right	, Top);
		glVertex2i(Right	, Bottom);
		glVertex2i(Left		, Bottom);
	glEnd();

	glColor3f(0,0,0);
	Font->drawText(TRectangle(Left, Top, Right, Bottom), TP_HCenter, TP_VCenter, Text.c_str());

	DrawFocusStippleLine();

	if (Pressed) glTranslatef(-1, -1, 0);
	
}


